﻿using System.Windows.Controls;
using XamlaApp.ViewModels;
using XamlaApp.Interfaces;

namespace XamlaApp.Views.UIViews
{
    public partial class ControlEditorView : UserControl, IXamlaElement, IDraggable
    {
        public FrameworkElementViewModel VM { get; set; }
        public ControlEditorView(FrameworkElementViewModel controlViewModel)
        {
            controlViewModel.RegisterPositionBoundElement(this);
            //bind the control element view model to this view
            DataContext = VM = controlViewModel;
            Canvas.SetLeft(this, VM.Left);
            Canvas.SetTop(this, VM.Top);
            InitializeComponent();
        }

        #region IDraggable Members

        public System.Windows.FrameworkElement DraggableElement
        {
            get { return this; }
        }

        public bool DragEnabled
        {
            get { return true; }
        }

        public void OnLocationChanged()
        {

        }

        public void OnDragStarted()
        {

        }

        public void OnDragEnded()
        {

        }

        public void OnDragging()
        {
        }

        #endregion
        
        #region IXamlaElement Members

        public UserControl Propertyview
        {
            get { throw new System.NotImplementedException(); }
        }

        public string ControlName
        {
            get
            {
                throw new System.NotImplementedException();
            }
            set
            {
                throw new System.NotImplementedException();
            }
        }

        public FrameworkElementViewModel ViewModel
        {
            get { return VM; }
        }

        public UserControl MenuButton
        {
            get
            {
                throw new System.NotImplementedException();
            }
            set
            {
                throw new System.NotImplementedException();
            }
        }

        public System.Windows.Media.PlaneProjection ElementProjection
        {
            get { throw new System.NotImplementedException(); }
        }

        #endregion
    }
}
